WCOPY

Syntax: WCOPY [#ch,] [wild1] [TO wild2] (Toolkit II)
    or: WCOPY [#ch,] wild1 TO wild2  (THOR)
Location: Toolkit II, THORs

The command WCOPY is intended to allow you to copy several files with a common root from one device to another, quickly and easily. It is however necessary to understand the way in which Toolkit II's wildcards work, as WCOPY uses these wildcards to find the required files.

A wildcard is a means of finding several files which have similar names. The first thing which any wildcard command does is to look at the supplied parameter and then compare this against each entry in the directory of the given device. If any of the filenames match exactly, or if the parameter forms the start of any filenames, those files are marked as chosen. 

For example,  
WCOPY flp1_D TO flp2_ 

would copy all files whose names are either 'D' or begin with the letter 'D' to flp2_ (the comparison is case independent).

If you place two underscores ('_') together as part of wild1, this is taken to be a wildcard and can in fact be replaced by any string of characters in order to match filenames with wild1.

Wildcards are further complicated by the fact that if a device name is not provided as part of wild1, then the default device will be added (which ends with an underscore, so if wild1 begins with an underscore, you will have a wildcard symbol!!)

A few examples of wildcards (assuming default device is 'flp1_'):

Wild1  wild card name  File matches
t      flp1_t          flp1_testa
                       flp1_test_v1.00_bas

_t     flp1__t         flp1_testa
                       flp1_test_v1.00_bas
                       flp1_old_v0.01_test_bas

Note the rules for determining the destination parameter wild2 are complex:

(1) If no device is given, but a filename is specified, WCOPY looks at wild1. The destination device is then assumed to be the same as the source device (ie. the device name specified as part of wild1, or if omitted, DATAD$).

(2) If the second parameter is omitted, then again WCOPY looks at wild1. If a device is given in the first parameter, then this is used as the destination device.  On the other hand, if no device was specified, then the default destination device will be used (see DESTD$).

(3) If a second parameter is given which includes a device name, then this is used!

Having decided upon the device to which the files are to be copied, WCOPY then looks at the remainder of wild2 to ascertain what to do with the filenames it has found. Note implicit wildcard placed at the end of both wild1 and wild2.

WCOPY will look at wild2 and compare each filename that it has found using the wildcards in wild1 in turn. If a wildcard in wild1 is matched by a wildcard in wild2, then that part of the source filename will be inserted into the destination filename. However, beyond this, WCOPY will use the rest of wild2 as the actual destination filename.

Any additional sections in wild1 or wild2 will be inserted after the drive name in the destination filename.

Having decided which files are to be copied and the names they are to be given on the device where they are being copied to, WCOPY will then request confirmation in the specified channel (default #0) for each file.

Example:
Assuming that the default data device is flp1_ and the default destination device is ram2_:

(1) WCOPY  
Copies all files on flp1_ to ram2_

(2) WCOPY flp1_test TO ram2_old
Copies:
flp1_testa to ram2_olda
flp1_test_v1.00_bas to ram2_old_v1.00_bas

(3) WCOPY flp1_test,ram2_old_
Copies:
flp1_testa to ram2_old_testa
flp1_test_v1.00_bas to ram2_old_test_v1.00_bas

(4) WCOPY _bas,ram2__
Copies:
ram1_test_v1.00_bas to ram2_test_v1.00_bas
ram1_old_v0.01_test_bas to ram2_old_v0.01_test_bas

(5) WCOPY old__ TO ram2_
Copies:
ram1_old_v0.01_test_bas to ram2_v0.01_test_bas
ram1_old_v1.00_exe to ram2_v1.00_exe
ram1_old_data to ram2_data

CROSS-REFERENCE:
SPL_USE and DEST_USE set the destination device. See COPY, WCOPY_F and WCOPY_O which are all similar. WREN, WDIR, WSTAT and WDEL all use wildcards.  COPY and SPL allow you to copy specific files.
